function pp(arr) {
  let newArr = []
  for (let i = 0; i < arr.length; i++) {
    if (Array.isArray(arr[i])) {
      newArr.push(...pp(arr[i]))
    } else {
      
    }
  }
  return newArr
}
console.log(pp([1, 2, 3, [4, 5, 6, [7, 8, 9]]]))
